package com.marchsoft.campushelp.domain;

import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;

/**
* @author 李诗莹
* @date 2020-03-13
*/
@Entity
@Data
@Table(name="campus_transfer_rewarder")
public class CampusTransferRewarder implements Serializable {

    /** 悬赏发布id */
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id")
    private Long id;

    /** 发布用户id */
    @Column(name = "rewarder_id")
    private Long rewarderId;

    /** 悬赏的名字 */
    @Column(name = "reward_name")
    private String rewardName;

    /** 悬赏分类 */
    @Column(name = "reward_type")
    private Integer rewardType;

    /** 单价 */
    @Column(name = "bank_type")
    private BigDecimal bankType;

    /** 标签 */
    @Column(name = "label")
    private String label;

    /** 数量 */
    @Column(name = "amount")
    private Integer amount;

    /** 提交期限 */
    @Column(name = "submit_time")
    private Timestamp submitTime;

    /** 详情 */
    @Column(name = "details")
    private String details;

    /** 0-发布，1-撤回，2-完成(状态） */
    @Column(name = "state")
    private Integer state;

    public void copy(CampusTransferRewarder source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}